<template>
  <div>
    <el-dialog
      :title="'需求收费'"
      :visible.sync="addShow"
      width="60%"
      :before-close="handleClose"
    >
      <el-form
        :model="form"
        ref="forms"
        label-width="100px"
        class="demo-ruleForm"
      >
        <div style="width: 100%; display: flex">
          <el-form-item label="项目编号" prop="projectCode">
            <template slot>
              <span>{{ this.codes }}</span>
            </template>
          </el-form-item>
        </div>
        <div style="width: 100%; display: flex">
          <el-form-item label="项目需求" prop="projectReqiure">
            <el-input
              type="textarea"
              v-model="form.projectRequire"
              :rows="4"
              style="width: 600px"
            ></el-input>
          </el-form-item>
        </div>
        <div style="width: 100%; display: flex">
          <el-form-item label="需求金额" prop="price">
            <el-input v-model="form.price" style="width: 600px"></el-input>
          </el-form-item>
        </div>
        <div style="width: 100%; display: flex">
          <el-form-item label="需求金额" prop="date">
            <el-date-picker
              v-model="form.date"
              style="width: 600px; margin: 0 0 0 0.5vw"
              placeholder="选择日期时间"
              value-format="yyyy-MM-dd"
              type="date"
              size="small"
            ></el-date-picker>
          </el-form-item>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import moment from "moment";
export default {
  props: ["projectCode", "addShow", "codes"],
  data() {
    return {
      form: {
        projectCode: "", //项目编号
        projectRequire: "", //项目需求
        price: "", //需求金额
        date: "",
      },
    };
  },
  methods: {
    handleClose() {
      this.$emit("closeAddShow", true);
      this.$refs.forms.resetFields();
      this.form.projectRequire = "";
    },
    submit() {
      this.form.projectCode = this.codes;
      this.$http.post("/postAddOthers", this.form).then((res) => {
        if (res.code == 200) {
          this.handleClose();
          this.$emit("refresh", true);
        }
      });
    },
  },
};
</script>

<style>
</style>